﻿<Application x:Class="YnabCsvConverter.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
   <Application.Resources>

      <Color x:Key="AccentColor" R="113" G="160" B="30" A="255" />
      <Color x:Key="AccentColor2" R="160" G="30" B="113" A="255" />

      <SolidColorBrush x:Key="HeaderBackground" Color="#E7E7E7" />
      <SolidColorBrush x:Key="DarkLine" Color="#B7B7B7" />
      <SolidColorBrush x:Key="AccentBrush" Color="{StaticResource AccentColor}" />
      <SolidColorBrush x:Key="AccentBrush2" Color="{StaticResource AccentColor2}" />

      <LinearGradientBrush x:Key="ButtonBackground" StartPoint="0,0" EndPoint="0,1">
         <LinearGradientBrush.GradientStops>
            <GradientStop Offset="0" Color="#FDFDFD" />
            <GradientStop Offset="1" Color="#C3C3C3" />
         </LinearGradientBrush.GradientStops>
      </LinearGradientBrush>
      
      <LinearGradientBrush x:Key="ButtonHoverBackground" StartPoint="0,0" EndPoint="0,1">
         <LinearGradientBrush.GradientStops>
            <GradientStop Offset="0" Color="#1978B0" />
            <GradientStop Offset="1" Color="#0B395A" />
         </LinearGradientBrush.GradientStops>
      </LinearGradientBrush>

      <LinearGradientBrush x:Key="ButtonPressedBackground" StartPoint="0,0" EndPoint="0,1">
         <LinearGradientBrush.GradientStops>
            <GradientStop Offset="0" Color="#39A8E0" />
            <GradientStop Offset="1" Color="#3B698A" />
         </LinearGradientBrush.GradientStops>
      </LinearGradientBrush>

      <Style x:Key="HeaderTextBlock" TargetType="TextBlock">
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="16" />
         <Setter Property="FontWeight" Value="Medium" />
         <Setter Property="Foreground" Value="#4D4D4D" />
      </Style>

      <Style x:Key="HeadlineTextBlock" TargetType="TextBlock">
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="16" />
         <Setter Property="FontWeight" Value="Medium" />
         <Setter Property="Foreground" Value="{StaticResource AccentBrush}" />
      </Style>

      <Style x:Key="ParagraphTextBlock" TargetType="TextBlock">
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="12" />
         <Setter Property="FontWeight" Value="Medium" />
         <Setter Property="Foreground" Value="#7D7D7D" />
      </Style>
      
      <Style x:Key="LabelTextBlock" TargetType="TextBlock">
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="12" />
         <Setter Property="FontWeight" Value="Medium" />
         <Setter Property="Foreground" Value="#4D4D4D" />
      </Style>

      <Style x:Key="ButtonTextBlock" TargetType="TextBlock">
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="12" />
         <Setter Property="FontWeight" Value="Medium" />
         <Setter Property="Foreground" Value="#4D4D4D" />
      </Style>

      <Style TargetType="TextBox">
         <Setter Property="BorderThickness" Value="0" />
         <Setter Property="Height" Value="25" />
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="12" />
         <Setter Property="FontWeight" Value="Normal" />
         <Setter Property="Foreground" Value="#7D7D7D" />
      </Style>

      <Style x:Key="DefaultTextBlock" TargetType="TextBlock">
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="12" />
         <Setter Property="FontWeight" Value="Normal" />
         <Setter Property="Foreground" Value="#7D7D7D" />
      </Style>

      <Style x:Key="LighterTextBlock" TargetType="TextBlock">
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="10" />
         <Setter Property="FontWeight" Value="Normal" />
         <Setter Property="Foreground" Value="#ADADAD" />
      </Style>

      <Style x:Key="MediumTextBlock" TargetType="TextBlock" BasedOn="{StaticResource DefaultTextBlock}">
         <Setter Property="FontWeight" Value="Medium" />
      </Style>

      <ControlTemplate  x:Key="ConverterDetailItemTemplate">
         <Grid>
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBlock Foreground="{TemplateBinding Foreground}" Grid.Column="0" HorizontalAlignment="Stretch" Style="{StaticResource DefaultTextBlock}" Text="{Binding Path=Name}" />
            <TextBlock Grid.Column="1" HorizontalAlignment="Right" Style="{StaticResource LighterTextBlock}" Text="{Binding Path=Author}" />
         </Grid>
      </ControlTemplate >

      <DataTemplate x:Key="ConverterItemTemplate">
         <TextBlock Grid.Column="0" HorizontalAlignment="Left" Style="{StaticResource DefaultTextBlock}" Text="{Binding Path=Name}" />
      </DataTemplate>


      <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
         <Border
            Name="border"
            BorderThickness="1,0,0,0"
            BorderBrush="{StaticResource DarkLine}"
            Background="{StaticResource ButtonBackground}"
            Width="25" Height="25">
            <Grid Name="Grid"  Background="Transparent">
               <Path Margin="7" Name="Arrow"  Stretch="Uniform" Data="M0,0 L0,2 L4,6 L8,2 L8,0 L4,4 z" Fill="#4D4D4D"/>
            </Grid>
         </Border>
         <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
               <Setter TargetName="border" Property="Background" Value="{StaticResource ButtonHoverBackground}" />
               <Setter TargetName="Arrow" Property="Fill" Value="White" />
            </Trigger>
         </ControlTemplate.Triggers>
      </ControlTemplate>

      <ControlTemplate x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}">
         <Border 
            x:Name="PART_ContentHost"
            Focusable="False"
            Background="{TemplateBinding Background}"
            CornerRadius="3"
            BorderThickness="1"
            BorderBrush="#666666" />
      </ControlTemplate>


      <Style TargetType="{x:Type ComboBox}">
         <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
         <Setter Property="SnapsToDevicePixels" Value="true" />
         <Setter Property="MinWidth" Value="120" />
         <Setter Property="MinHeight" Value="25" />
         <Setter Property="Control.Template">
            <Setter.Value>
               <ControlTemplate TargetType="ComboBox">
                  <Grid>

                     <Border
                        BorderThickness="1"
                        BorderBrush="{StaticResource DarkLine}"
                        Background="#FFFFFF">
                        <ContentPresenter
                           x:Name="ContentSite"
                           IsHitTestVisible="False"
                           Content="{TemplateBinding SelectionBoxItem}"
                           ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                           ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                           Margin="3,3,23,3"
                           VerticalAlignment="Stretch"
                           HorizontalAlignment="Left"
                           Focusable="False">
                        </ContentPresenter>
                     </Border>

                     <ToggleButton
                        Name="ToggleButton"
                        Margin="1"
                        Template="{StaticResource ComboBoxToggleButton}"
                        Focusable="False"
                        ClickMode="Press"
                        IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                        HorizontalAlignment="Right"
                      />

                     <TextBox 
                        x:Name="PART_EditableTextBox"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Bottom"
                        Template="{StaticResource ComboBoxTextBox}"
                        Visibility="Hidden"/>

                     <Popup 
                        Name="PART_Popup"
                        IsOpen="{TemplateBinding ComboBox.IsDropDownOpen}"
                        Margin="0,-2"
                        >
                        <Grid
                           Background="Transparent"
                           MaxHeight="{TemplateBinding ComboBox.MaxDropDownHeight}"
                           MinWidth="{TemplateBinding FrameworkElement.ActualWidth}">
                           <Border
                              BorderThickness="1,1,1,1"
                              BorderBrush="{StaticResource DarkLine}"
                              Margin="0">
                              <Grid
                                 Name="DropDown"
                                 Background="#FFFFFF">
                                 <ScrollViewer Margin="0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto">
                                    <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"/>
                                 </ScrollViewer>
                              </Grid>
                           </Border>
                        </Grid>
                     </Popup>
                  </Grid>
                  <ControlTemplate.Triggers>
                     <!--<Trigger Property="IsMouseOver" Value="True">
                        --><!--<Setter TargetName="PART_Popup" Property="IsOpen" Value="True" />--><!--
                     </Trigger>-->
                  </ControlTemplate.Triggers>
               </ControlTemplate>
            </Setter.Value>
         </Setter>
      </Style>

      <Style TargetType="{x:Type ComboBoxItem}">
         <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
         <Setter Property="Control.Template">
            <Setter.Value>
               <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                  <Grid Name="Grid" MinHeight="25">
                     <ContentPresenter VerticalAlignment="Center" Margin="10,0"/>
                  </Grid>

                  <ControlTemplate.Triggers>
                     <Trigger Property="IsMouseOver" Value="True">
                        <Setter TargetName="Grid" Property="Background" Value="#F5F5F5" />
                     </Trigger>
                  </ControlTemplate.Triggers>
               </ControlTemplate>
            </Setter.Value>
         </Setter>
      </Style>

      <Style TargetType="Button">
         <Setter Property="Height" Value="25" />
         <Setter Property="Template">
            <Setter.Value>
               <ControlTemplate TargetType="{x:Type Button}">
                  <Border
                     Name="border"
                     CornerRadius="3" 
                     BorderThickness="1" 
                     BorderBrush="#666666"
                     Background="{StaticResource ButtonBackground}"
                     >
                     <TextBlock Style="{StaticResource ButtonTextBlock}" Name="text" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}">
                        <ContentPresenter />
                     </TextBlock>
                  </Border>

                  <ControlTemplate.Triggers>
                     <Trigger Property="IsMouseOver" Value="True">
                        <Setter TargetName="border" Property="Background" Value="{StaticResource ButtonHoverBackground}" />
                        <Setter TargetName="text" Property="Foreground" Value="#FFFFFF" />
                     </Trigger>
                     <Trigger Property="IsPressed" Value="True">
                        <Setter TargetName="border" Property="Background" Value="{StaticResource ButtonPressedBackground}" />
                        <Setter TargetName="text" Property="Foreground" Value="#FFFFFF" />
                     </Trigger>
                     <Trigger Property="IsFocused" Value="True">
                     </Trigger>
                  </ControlTemplate.Triggers>
               </ControlTemplate>

            </Setter.Value>
         </Setter>
      </Style>

   </Application.Resources>
</Application>
